// Fill out your copyright notice in the Description page of Project Settings.


#include "CharacterZD/Core/RulePaperZDAnimInstance.h"

#include "CharacterZD/Core/RuleCharacterZD.h"

URulePaperZDAnimInstance::URulePaperZDAnimInstance() : bDeath(false), bAttack(false), Speed(0.0f), CurrentDirection(-1.0f,0.0f)
{
}

void URulePaperZDAnimInstance::OnInit_Implementation()
{
	Super::OnInit_Implementation();
	OwnerCharacter = Cast<ARuleCharacterZD>(GetOwningActor());
}

void URulePaperZDAnimInstance::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	if (OwnerCharacter)
	{
		bAttack = OwnerCharacter->bAttack;
		bDeath = !OwnerCharacter->IsActive();
		Speed = OwnerCharacter->GetVelocity().Size();

		if (const FVector Velocity = OwnerCharacter->GetVelocity(); Velocity != FVector::Zero())
		{
			CurrentDirection.X = Velocity.X;
			CurrentDirection.Y = Velocity.Y;
		}
	}
}

void URulePaperZDAnimInstance::SetDirection(const FVector& Direction)
{

}
